package com.ivi.car.base;


import android.arch.lifecycle.Lifecycle;

import com.trello.rxlifecycle2.LifecycleProvider;

/**
 * 业务处理基类
 * 
 * @param <T>
 */
public abstract class BasePresenter<T extends IBaseView> {
  private final String tag = getClass().getSimpleName();

  /**
   * 绑定生命周期请求请加上.compose(provider.bindToLifecycle())
   */
  protected LifecycleProvider<Lifecycle.Event> mProvider;
  protected T mView;

  public BasePresenter(T view, LifecycleProvider<Lifecycle.Event> provider) {
    this.mProvider = provider;
    this.mView = view;
  }

  /**
   * 清除view
   */
  public void onDestroy() {
    mView = null;
  }

  public String getTag() {
    return tag;
  }

  // /**
  // * 耗时请求绑定生命周期
  // * @param observable
  // * @param <T>
  // * @return
  // */
  // public <T> Observable<T> bindLifeCycle(Observable<T> observable) {
  // return observable
  // .compose(mProvider.bindToLifecycle());
  //
  // }
}
